function addProductInOrder() {
    var moreInfo = {};
    moreInfo.ma = $("#add_ma").val();
    moreInfo.soLuong = $("#add_soLuong").val();
    moreInfo.donGia = $("#add_donGia").val();
    $("#productOrder_tpl").tmpl(moreInfo).appendTo( "#allChildren_id" );

    reCalDataAsJson();

    //reset input value
    $("#add_ma").val("");
    $("#add_soLuong").val("");
    $("#add_donGia").val("");
}

function delMoreInfo(node) {
    alert("Call DEL");
    alert(node.toString());
    var ul = node.parentNode.parentNode;
    var container = ul.parentNode.removeChild(ul);

    reCalMoreInfoAsJson();
}

function reCalDataAsJson() {
    var datas = [];
    $(".ul_productOrder").each(function(i,ul) {
        var one={};
        //oneMore.id = parseInt(ul.title);

        var lis = $(ul).find("li");
        one.ma = $.trim(lis[0].innerHTML);
        one.soLuong = $.trim(lis[1].innerHTML);
        one.donGia = $.trim(lis[1].innerHTML);

        datas.push(one);
    })

    var dataAsStr = $.toJSON(datas);
    console.log(dataAsStr);
    $("#children_id").val(dataAsStr);
}




